package top.withu.gaof.freehope.dao;

import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import top.withu.gaof.freehope.model.User;

/**
 * @author Gaofan
 * @date 2019年4月23日 上午11:14:30
 * @describe
 */
@Repository
public interface UserDao extends JpaRepository<User, String> {

	// 查找用户
	User findTop1ByUserNameAndIsExpire(String userName, Boolean isExpire, Sort sort);

	// 用户登录认证
	@Query("select u from User u where u.userName = :userName and u.pwd = :pwd")
	User getUser(@Param("userName") String userName, @Param("pwd") String pwd);

}
